<?php
class ExceptionLib extends Exception {
    private $data;

    /**
     * 异常时可能也要返回数据，比如密码多次错误返回验证码
     */
    public function __construct($msg, $code, $data=array()) {
        parent::__construct($msg, $code);
        $map = ConfigParserLib::get('error_code', 'code');
        $this->data = $data;
        $this->message = $map[$code];
    }
}
?>
